<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
%>
<html>
    <head>

        <title>byAMFI - New Brand</title>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="<%=request.getContextPath()%>/style/style.css" type="text/css"/>    

    </head>

    <body id="bodyManagement">

        <div id="managementMenu">
            <a class="managementLink" href="../category/overview">CATEGORIES</a>  
            |  <a class="managementLink" href="../products/overview">PRODUCTS</a>
            |  <a class="managementLink" href="../brand/overview" style="font-size: 17px;"><b>BRANDS</b></a>
        </div>
        
        
        <div class="errors">
            <!--<p>test</p>-->

            <c:choose>
                <c:when test="${not empty errors}">
                    <!-- Als er geen id is meegegeven, ga je een gebruiker toevoegen -->
                    <c:forEach var="error" items="${errors}">
                        <b>${error}</b><br>
                    </c:forEach>
                </c:when>

                <c:otherwise>
                    <!--<p>no errors</p>-->
                </c:otherwise>
            </c:choose>


        </div>
        <div id ="newProduct">
            <c:choose>
                <c:when test="${empty brand.brand_id}">
                    <!-- Als er geen id is meegegeven, ga je een gebruiker toevoegen -->
                    <form id="nieuwNieuws" action="new" method="post" enctype="multipart/form-data">
                    </c:when>

                    <c:otherwise>
                        <!-- Anders ga je een gebruiker wijzigen -->
                        <form id="wijzigenNieuws" action="edit" method="post" enctype="multipart/form-data">
                        </c:otherwise>
                    </c:choose>

                    <p>
                        <c:if test="${not empty brand.brand_id}">
                            <!-- Het id wordt meegestuurd, om te bepalen welke gebruiker je gaat wijzigen -->
                            <input type="hidden" name="brand_id" id="brand_id" value="${brand.brand_id}" />
                            <input type="hidden" name="brand_image_old" id="brand_image_old" value="${brand.brand_image}" />

                        </c:if>
                    </p>

                    <table border="0">
                        <tr>
                            <td><label for="brand_name">Brand Name:</label></td>
                            <td><input class="inputBackground" type="text" id="brand_name" name="brand_name" value="${brand.brand_name}" /></td>
                        </tr>

                        <c:choose>
                            <c:when test="${not empty brand.brand_id}">
                                <!-- Als er geen id is meegegeven, ga je een gebruiker toevoegen -->
                                <tr>
                                    <td><label>Current Image</label></td>
                                    <td><img style="height:50px;" src="<%=request.getContextPath()%>/brand/uploads/${brand.brand_image}"/></td>
                                </tr>
                            </c:when>
                        </c:choose>
                        <tr>
                            <td><label for="brand_image">Brand Image: </label></td>
                            <td><input id="fileName" type="file" name="brand_image" size="30"/><br/>      </td>
                        </tr>


                        
                        <tr><td>
                            
                            <br>
                            <button type="submit" style="border: 0; background: transparent">
                                <img src="../../style/images/button_addBrand.png" width="110" height="30" alt="submit" />
                            </button>    
                        
                            </td></tr> 

                    </table>

                </form>
        </div>
    </body>  
</html>